﻿<!--<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8">
    <title>插入音乐</title>
    <script type="text/javascript" src="../internal.js"></script>
    <link rel="stylesheet" type="text/css" href="music.css">
</head>
<body>
<div class="wrapper">
    <div class="searchBar">
        <input id="J_searchName" type="text"/>
        <input type="button" class="searchBtn" id="J_searchBtn">
    </div>
    <div class="resultBar" id="J_resultBar">
        <div class="loading" style="display:none"></div>
        <div class="empty"><var id="lang_input_tips"></var></div>
    </div>
    <div id="J_preview"></div>
</div>
<script type="text/javascript" src="music.js"></script>
<script type="text/javascript">
    var music = new Music;
    dialog.onok = function () {
        music.exec();
    };
    dialog.oncancel = function () {
        $G('J_preview').innerHTML = "";
    };
</script>
</body>
</html>-->
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <script type="text/javascript" src="../internal.js"></script>
    <style type="text/css">
        * {
            margin: 0;
            padding: 0;
            color: #838383;
        }

        table {
            font-size: 12px;
            margin: 10px;
            line-height: 30px;
        }

        .txt {
            width: 300px;
            height: 21px;
            line-height: 21px;
            border: 1px solid #d7d7d7;
        }
    </style>
</head>
<body>

    <table>
        <tr>
            <td><label for="href">音频地址：</label></td>
            <td><input class="txt" id="href" type="text" /></td>
        </tr>
    </table>
    <script type="text/javascript">
        function handleDialogOk() {
            if ($G('href').value) {
                var patt1 = /ogg|oga|aac|m4a|mp3|wav/gi;

                if (patt1.test($G('href').value)) {
                    editor.execCommand('insertHtml', "<object>" + "<audio controls>" +
                        "<source src=\"" + $G('href').value + "\" >" +
                        "Your browser does not support the audio tag" +
                        "</audio>" + "</object>");
                    dialog.close();

                } else {
                    alert("不支持该音频格式");
                    return false;
                }

            } else {
                alert("请输入音频地址");
                return false;
            }
        }
        dialog.onok = handleDialogOk;
        $G('href').onkeydown = function (evt) {
            evt = evt || window.event;
            if (evt.keyCode == 13) {
                handleDialogOk();
                return false;
            }
        }
    </script>
</body>
</html>